<?php
define('IN_TG',true);
define('IN_JS',true);
define('SCRIPT',true);
require('includes/common.inc.php');
$return_url=isset($_GET['return_url'])?$_GET['return_url']:$_SERVER['HTTP_HOST'].'/TestGuest';
if(isset($_GET['id']))
{
    $affected=1;
    if(isset($_COOKIE['username']))
    {
        //
        $sql="update tg_user set tg_skin={$_GET['id']} where tg_username='{$_COOKIE['username']}'";
        $res=_query($sql);
        $affected=_affected_rows();
    }
    setcookie('skin',$_GET['id'],time()+1000);
    if ($affected == 1) {
        _close();
        _location('风格修改成功',$return_url);
    } else {
        _close();
        _location('已经是该风格了，请不要重复修改',$return_url);
    }
}
else
{
    _location('已经是该风格了，请不要重复修改',$return_url);
}
?>